﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace EnsureWeb.Share
{

    // Define how to Add, Get, Delete the object cache want
	public interface ICacheStrategy {

		// Add Object
		void AddItem(string key, object obj);

        // Access to object
		object GetItem(string key);

		// Remove object
		void RemoveItem(string key);
	}


	public class DefaultCacheStrategy : ICacheStrategy {

		private Hashtable objectStore;

		public DefaultCacheStrategy() {
			objectStore = new Hashtable();
		}

		public void AddItem(string key, object obj) {
			objectStore.Add(key, obj);
		}

		public object GetItem(string key) {
			return objectStore[key];
		}

		public void RemoveItem(string key) {
			objectStore.Remove(key);
		}
	}
}
